﻿@using ZBJF.Warranty.BLL
@using ZBJF.Warranty.Common.Enums
@using ZBJF.Warranty.Model
@using ZBJF.Warranty.WebProvider
@model ZBJF.Warranty.Model.CleaningProduct
@{
    var id = Model != null ? Model.ID : 0;
}
<ul class="nav nav-tabs">
    <li><a href="/Cleaning/CleaningProduct/CleaningProductIndex">清洗产品列表</a></li>
    <li class="active"><a href="/Cleaning/CleaningProduct/CleaningProductEdit/0">添加清洗产品</a></li>
</ul>
@using (Html.BeginForm("SaveCleaningProduct", "CleaningProduct", FormMethod.Post, new { id = "inputForm", name = "inputForm", @class = "form-horizontal" }))
{
    @Html.HiddenFor(m => m.ID)
    <div class="control-group">
        <label class="control-label">清洗产品名称：</label>
        <div class="controls">
            @Html.TextBoxFor(m => m.ProductName, new {  validate = "{required:true,messages:{required:'请输入清洗产品名称'}}" ,maxlength=20})
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">单价：</label>
        <div class="controls">
            @Html.TextBoxFor(m => m.Price, new { validate = "{required:true,messages:{required:'请输入单价'}}", maxlength = 8,onkeyup="onlyInputDecimal(this, 2)" })
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">单位说明：</label>
        <div class="controls">
            @Html.TextBoxFor(m => m.UnitInstruction, new { maxlength = 20 })
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">产品描述：</label>
        <div class="controls">
            @Html.TextBoxFor(m => m.ProductDescribe, new { maxlength = 50 })
        </div>
    </div>
    <div class="control-group">
        <label class="control-label"></label>
        <div class="controls">
            <label>
                @Html.CheckBox("IsAvailable", Model == null?true:Model.IsAvailable)
                是否可用
            </label>
        </div>
    </div>
    <div class="form-actions">
        <input id="btnSubmit" class="btn btn-primary Edit-R" type="button" value="保存" onclick="loading(this)">
        <input id="btnCancel" class="btn" type="button" value="重置" onclick="reset()">
    </div>
}

@section scripts{
    <script>
        function reset() {
            document.getElementById("inputForm").reset();
        }
        function loading(_this) {
            if ($("#inputForm").valid()) {
                _this.disabled = 'disabled';
                document.getElementById("inputForm").submit();
            }
        }
    </script>
}